<?php


/**
 * Radcodes - SocialEngine Module
 *
 * @category   Application_Extensions
 * @package    Badge
 * @copyright  Copyright (c) 2009-2010 Radcodes LLC (http://www.radcodes.com)
 * @license    http://www.radcodes.com/license/
 * @version    $Id$
 * @author     Vincent Van <vincent@radcodes.com>
 */
 
 
?>

<div class="headline">
  <h2>
    <?php echo $this->translate('Badges');?>
  </h2>
  <div class="tabs">
    <?php
      // Render the menu
      echo $this->navigation()
        ->menu()
        ->setContainer($this->navigation)
        ->render();
    ?>
  </div>
</div>

<div class='layout_right'>
  <?php echo $this->form->render($this) ?>
</div>

<div class='layout_middle badge_layout_middle'>
  
  <?php if( $this->keyword):?>
    <div class="badges_result_filter_details">

        <?php echo $this->translate('Showing requests posted with keyword %s', $this->htmlLink(
          $this->url(array('keyword'=>$this->keyword, 'action'=>'browse'), 'badge_request_general', true),
          $this->keyword
        ));?>
      <?php echo $this->htmlLink(array('route'=>'badge_request_general', 'action'=>'browse'), $this->translate('(x)'))?>
    </div>
  <?php endif; ?>
  
  <?php if( $this->paginator->getTotalItemCount() > 0 ): ?>
  
    <table class=badge_request_table>
      <thead>
        <tr>
          <th>ID</th>
          <th><?php echo $this->translate('Photo');?></th>
          <th><?php echo $this->translate('Badge');?></th>
          <th><?php echo $this->translate('Submitted');?></th>
          <th><?php echo $this->translate('Status'); ?></th>
          <th><?php echo $this->translate("Options") ?></th>
        </tr>
      </thead>
      <tbody>
        <?php foreach ($this->paginator as $request): $badge = $request->getBadge(); ?>
          <tr>
            <td><?php echo $request->getIdentity(); ?></td>
            <td class='badge_request_table_bold'><?php echo $this->htmlLink($badge->getHref(), $this->itemPhoto($badge, 'thumb.icon'));?></td>
            <td><?php echo $badge->__toString(); ?></td>  
            <td>
              <?php echo $this->locale()->toDateTime($request->creation_date) ?>
            </td>
            <td>
              <?php echo $this->translate($request->status);?>
            </td>
            <td>
              <?php echo $this->htmlLink($request->getHref(), $this->translate("view details"), array('class' => 'smoothbox')) ?>
            </td>
          </tr>
        <?php endforeach; ?>
      </tbody>
    </table>

  <?php elseif($this->keyword): ?>
    <div class="tip">
      <span>
        <?php echo $this->translate('There are no requests with that criteria.');?>
      </span>
    </div>
  <?php else:?>
    <div class="tip">
      <span>
        <?php echo $this->translate('You have not made any requests to have badge yet.');?>
      </span>
    </div>
  <?php endif; ?>

    <?php echo $this->paginationControl($this->paginator, null, null, array(
      'query' => $this->formValues
    )); ?>    

</div>
